package fr.sharpe.app.earthvisualizationdatamodel;

import gov.nasa.worldwind.avlist.AVKey;
import gov.nasa.worldwind.geom.Position;
import gov.nasa.worldwind.render.AnnotationAttributes;
import gov.nasa.worldwind.render.FrameFactory;
import gov.nasa.worldwind.render.GlobeAnnotation;

import java.awt.Color;
import java.awt.Font;
import java.awt.Point;
import java.io.Serializable;

public class Text implements Serializable {

	private String id;
	private double latitude;
	private double longitude;
	private String value;
	private Color color;
	private Data data;
	
	public Text(String id,String value,double latitude, double longitude, Color color, Data data)
	{
		this.id = id;
		this.latitude = latitude;
		this.longitude = longitude;
		this.value = value;
		this.color = color;
		this.data = data;
	}
	
	public GlobeAnnotation getText()
	{
		AnnotationAttributes geoAttr = new AnnotationAttributes();
        geoAttr.setFrameShape(FrameFactory.SHAPE_NONE);  // No frame
        geoAttr.setFont(Font.decode("Arial-12"));
        geoAttr.setTextColor(color);
        geoAttr.setTextAlign(AVKey.CENTER);
        geoAttr.setDrawOffset(new Point(0, 5)); // centered just above
//        geoAttr.setEffect(AVKey.TEXT_EFFECT_OUTLINE);  // Black outline
        geoAttr.setBackgroundColor(Color.GRAY);
        return new GlobeAnnotation(value,Position.fromDegrees(latitude,longitude, 0), geoAttr);
	}
	
	public String getId()
	{
		return this.id;
	}

	public double getLatitude() {
		return latitude;
	}

	public void setLatitude(double latitude) {
		this.latitude = latitude;
	}

	public double getLongitude() {
		return longitude;
	}

	public void setLongitude(double longitude) {
		this.longitude = longitude;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public Color getColor() {
		return color;
	}

	public void setColor(Color color) {
		this.color = color;
	}

	public Data getData() {
		return data;
	}

	public void setData(Data data) {
		this.data = data;
	}

	public void setId(String id) {
		this.id = id;
	}
}
